package copyengine.ui.infoTree.buildTree.builder
{
    import copyengine.infoTree.meta.CESShapeMeta;
    import copyengine.resource.CEResUtils;
    import copyengine.ui.infoTree.buildTree.InfoTreeBuildUtils;

    import flash.utils.Dictionary;

    import starling.display.DisplayObject;
    import starling.display.Image;
    import starling.textures.Texture;

    public class InfoTreeBuilderImage extends InfoTreeBuilderBasic
    {

        public function InfoTreeBuilderImage()
        {
            super();
        }

        override public function isCanHandleMeta(_meta:*):Boolean {return _meta is CESShapeMeta;}

        override public function getBuildResultMc(_meta:*, _quickFindDic:Dictionary, _quickFindKeyPR:String, _isRoot:Boolean):DisplayObject
        {
            var meta:CESShapeMeta = _meta as CESShapeMeta;
            var texture:Texture = CEResUtils.getTextureFromAtlas(meta.textureMeta.textureFileName, meta.textureMeta.textureKey, mResProxy);
            var img:Image = new Image(texture);
            InfoTreeBuildUtils.setBasicInfoByMeta(meta, img);
            InfoTreeBuildUtils.addToQuickFindDic(img, _quickFindDic, _quickFindKeyPR, _isRoot);
            return img;
        }
    }
}
